package com.aratek.huwai.common;

import com.alibaba.fastjson.JSONObject;

import java.util.HashMap;

/**
 * @Author 姜寄羽
 * 构建器形式构建JSON对象
 * @Date 2017/12/22 10:47
 */
public class JsonObjectBuilder extends HashMap<String, Object> {

    public static JsonObjectBuilder create(){
        return new JsonObjectBuilder();
    }

    @Override
    public JsonObjectBuilder put(String key, Object value) {
        super.put(key, value);
        return this;
    }

    public JSONObject toJSON(){
        return new JSONObject(this);
    }
}
